package com.ys.web.dao.impl;

import java.util.Iterator;
import java.util.List;

import org.apache.ws.commons.schema.extensions.DefaultExtensionDeserializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.ys.web.dao.CommonDao;
import com.ys.web.dao.GenericBaseCommonDao;
import com.ys.web.entity.Backup;
import com.ys.web.entity.Company;
import com.ys.web.entity.UserRole;

/**
 * 公共拓展方法-Dao-实现类
 * @author wdj
 *
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Repository
public class CommonDaoImpl extends GenericBaseCommonDaoImpl implements CommonDao,GenericBaseCommonDao {

	 
	@Override
	public String getCompanyName(Integer id) {
		Company company = (Company) this.getEntity(Company.class, id);
		
		return company.getCompanyName();
	}

	@Override
	public String getCompanyPath(Integer companyId) {
		String hql = "from Backup where companyId=?";
		List<Backup> backups = this.findHql(hql, companyId);
		Backup backup = new Backup();
		Integer id;
		Iterator it = backups.iterator();
		if(it.hasNext()){
			backup = (Backup) it.next();
			id = backup.getId();
			backup = (Backup) this.getEntity(Backup.class, id);
		}
		return backup.getPath();
	}

	
	
	


}
